-
.
GCC (GNU C Compiler -> GNU Compiler Collection)
About
-
Originally, the name was "GNU C Compiler" because it only compiled the C language. Over time, it began to support other languages and was renamed "GNU Compiler Collection".
-
Part of the GNU project; widely used in Linux. Supports multiple languages.
-
License :
-
Open-source GPL.
-
-
Platforms :
-
Windows (via MinGW), Linux, macOS, BSD
-
-
Debugging
-
GDB.
-
-
Minimum requirements :
-
Windows:
-
MinGW.
-
~MSYS2.
-
You don't need MSYS2 to use GCC on Windows. MinGW already provides GCC ready to use.
-
MSYS2 is an additional environment that facilitates installation and package management, but it is not mandatory.
-
-
-
Linux:
-
Just the package.
-
-
gcc -o main main.c
gcc -o main main.c random.c -lm
Installing
-
Version :
-
(2025-06-13) 14.2.0
-
-
Choosing a Toolchain and Runtime :
-
For Linux :
-
.
-
-
For Windows :
-
I stay away from MSVC, as it's a Windows thing.
-
Via MSYS2 without MSVC :
-
All three use
MinGW (GNU) ABI, so no MSVC dependency. -
UCRT64 :
pacman -S mingw-w64-ucrt-x86_64-gcc-
Compiler : GCC
-
ABI : MinGW (GNU)
-
Runtime : UCRT
-
Environment : UCRT64
-
Architecture : x86_64
-
Installed at :
C:/msys64/ucrt64/bin. -
Modern setup; recommended GCC on Windows.
-
-
MINGW64 :
pacman -S mingw-w64-x86_64-gcc-
Compiler : GCC
-
ABI : MinGW (GNU)
-
Runtime : MSVCRT
-
It's a very old Microsoft runtime, outdated (missing newer C features, UTF-8 issues)
-
Legacy, very compatible.
-
-
Environment : MINGW64
-
Architecture : x86_64
-
Installed at :
C:/msys64/mingw64/bin.
-
-
CLANG64-
GCC is not typically used in CLANG64.
-
The environment is designed around Clang/LLVM.
-
-
-
Commands
-
-o-
Sets the name of the output file.
-
-
-std=c11-
Specify Language Standard.
-
C89, C99, C11, C17, etc.
-
-ansi-
Forces compliance with C89/C90.
-
-
-
Compilation :
-
-c-
Compile without linking, creating the object file
.o/.obj.
-
-
-v-
Verbose mode (shows compilation steps).
-
-
-
Linking :
-
-l<name>-
Link with a library.
-
-lm-
Link with the Math Library
libm.-
Needed for functions like
sin(),cos(),sqrt(),pow(), etc.
-
-
-
-lpthread.-
For threads.
-
-
-
-L<path>-
Adds a library directory.
-
-L./lib.
-
-
-static-
Link statically (avoids dynamic dependencies).
-
-
-shared-
Generates a shared library (
.so/.dll).
-
-
-fPIC-
Generates position-independent code (used in shared libs).
-
-
-
Pre-processor / Macro :
-
-I<path>-
Adds an include directory.
-
-I./include.-
Looks for headers in
./include.
-
-
-
-D<macro>-
Defines a macro (ex:
-DDEBUGis equivalent todefine DEBUG).
-
-
-U<macro>-
Undefines a macro.
-
-
-E-
Only preprocesses (outputs
includeanddefineresults).
-
-
-M-
Generates build dependencies (useful for Makefiles).
-
-
-
Debug :
-
-g-
Includes debug symbols (needed for gdb and valgrind ).
-
-
-ggdb-
Optimizes debug symbols for GDB (more detailed than
-g).
-
-
-fsanitize=address-
Detects memory leaks, buffer overflows (AddressSanitizer).
-
-
-fsanitize=undefined-
Detects undefined behavior (UB).
-
-
-fstack-protector-
Protection against stack smashing.
-
-
-fno-stack-protector-
Disables stack overflow protection.
-
-
-
Warnings / Errors :
-
-Wall-
Enable Compilation Warnings.
-
-
-Wextra-
Enables extra warnings beyond
-Wall.
-
-
-Wpedantic-
Enforces strict C standard compliance (complains about GNU extensions).
-
-
-Wno-warning_name-
Disables a specific warning (ex:
-Wno-unused-variable).
-
-
-Werror-
Treat Warning as Errors.
-
-
-
Optimizations :
-
-O0-
No optimization (better for debugging).
-
-
-O1,-O2,-O3-
Levels of code optimization. Higher = faster, but harder to debug.
-
-
-Os-
Optimization for size (reduces executable).
-
-
-Ofast-
Aggressive optimization + relaxes IEEE standards (may affect precision).
-
-
Clang/LLVM (Low-Level Virtual Machine)
About
-
Clang/LLVM gives you :
-
C/C++ frontend (clang, clang++)
-
Optimizer (LLVM IR passes)
-
Code generation (machine code)
-
Optional linker (lld)
-
-
LLVM/Clang is not a complete toolchain by itself—it is mainly a compiler frontend + optimizer + code generator.
-
What it doesn't give you :
-
Standard libraries
-
C standard library (libc)
-
C++ standard library (libc++ or libstdc++)
-
-
Platform runtime
-
Startup code (mainCRTStartup, etc.)
-
Exception handling
-
Threading support
-
These are platform-specific and not provided by LLVM itself.
-
-
System headers
-
stdio.h,windows.h, etc. -
Definitions for OS APIs
-
-
System libraries
-
Windows APIs (kernel32.lib, etc.)
-
Required for linking executables
-
-
-
To get what is missing :
-
For windows:
-
MSVC toolchain
-
Microsoft’s C runtime (MSVCRT / UCRT)
-
Windows SDK headers/libs
-
Linker and startup code
-
-
MinGW / MSYS2
-
GCC-compatible runtime
-
Open-source Windows headers/libs
-
GNU-style environment
-
-
-
-
About LLVM with MSVC :
-
I don't like it, as it's a Windows thing.
-
lld-link:
-
Is LLVM’s drop-in replacement for the MSVC linker (link.exe)
-
So when you see
lld-link: error ..., it means Clang is operating in MSVC mode.
-
-
For libs:
-
It uses MSVC conventions, like:
-
.lib libraries
-
no lib prefix
-
-
COFF format expectations
| Mode | Expected file |
| ----------- | ------------- |
| MSVC |raylib.lib|
| GNU (MinGW) |libraylib.a|
-
-
-
It is not a single package but a collection of modular tools and libraries for compilation. It forms a complete compilation infrastructure, which can include multiple related components.
-
Depending on the distribution or installation method, not all components may be included.
-
Packages :
-
llvm
-
clang
-
clang-tools-extra
-
flang
-
mlir
-
lld
-
lldb
-
polly
-
libLTO
-
compiler-rt
-
libunwind
-
libc++
-
lib++abi
-
openmp
-
llvm-ar
-
llvm-nm
-
llvm-objdump
-
llvm-cov
-
llvm-profdata
-
llvm-dwarfdump
-
llvm-symbolizer
-
wasm-ld
-
-
High compatibility with GCC.
-
License :
-
Open-source Apache 2.0.
-
-
Platforms :
-
Windows, Linux, macOS, BSD
-
-
Debugging
-
LLDB.
-
More modern than GDB.
-
-
-
Minimum requirements :
-
Windows / Linux / macOS:
-
LLVM.
-
-
-
LLVM .
-
.
-
-
Cool.
-
-
LLVMIR explanation and demonstration
-
"IR is much more verbose by default, to allow for some specific optimizations".
-
Installation
-
Version :
-
llvm-config --version -
(2025-06-13) 21.1.7
-
-
Install LLVM or Clang?
-
llvm
-
Backend + toolchain infrastructure
-
Only if you need LLVM tools directly
-
-
clang
-
Actual compiler (frontend)
-
If you want to compile code
-
-
-
Choosing a Toolchain and Runtime :
-
For Linux :
-
For Windows :
-
I stay away from MSVC, as it's a Windows thing.
-
Via MSYS2 without MSVC :
-
All three use
MinGW (GNU) ABI, so no MSVC dependency. -
A installation can be removed with
pacman -Rs <name> -
UCRT64 :
pacman -S mingw-w64-ucrt-x86_64-clang-
Compiler : Clang (LLVM)
-
ABI : MinGW (GNU)
-
Runtime : UCRT
-
Environment : UCRT64
-
Architecture : x86_64
-
Installed at :
C:/msys64/ucrt64/bin. -
Size : 1112MB
-
Modern setup; recommended for non-MSVC Clang on Windows.
-
-
CLANG64 :
pacman -S mingw-w64-clang-x86_64-clang-
Compiler : Clang (LLVM)
-
ABI : MinGW (GNU)
-
Runtime : UCRT
-
Environment : CLANG64
-
Architecture : x86_64
-
Installed at :
C:/msys64/clang64/bin. -
Size : 900.7MB
-
(2026-04-03) It didn't install correctly the
clang.exein Paola's PC.
-
-
MINGW64 :
pacman -S mingw-w64-x86_64-clang-
Compiler : Clang (LLVM)
-
ABI : MinGW (GNU)
-
Runtime : MSVCRT
-
It's a very old Microsoft runtime, outdated (missing newer C features, UTF-8 issues)
-
Legacy, very compatible.
-
-
Environment : MINGW64
-
Architecture : x86_64
-
Installed at :
C:/msys64/mingw64/bin.
-
-
Via LLVM-MinGW :
-
-
llvm-mingw-20260324-ucrt-x86_64.zip.-
Compiler : Clang (LLVM)
-
ABI : MinGW (GNU)
-
Runtime : UCRT runtime
-
Environment : MINGW64
-
Architecture : x86_64
-
Installed at : manual install.
-
Size : 704MB.
-
-
-
-
LLVM-Project-
Installs with MSVC.
-
Release:
LLVM-22.1.2-win64.exe-
Installs
x86_64-pc-windows-msvc. -
(2026-04-04) Not added to PATH, even tho I marked the option to do it.
-
-
clang+llvm-22.1.2-x86_64-pc-windows-msvc.tar.xz-
Installs
x86_64-pc-windows-msvc. -
A zip, not the installer, therefore not automatically added to the path.
-
-
-
-
For macOS :
-
On macOS you don’t need an MSYS2-style environment. The system already has a Clang-based toolchain provided by Apple.
-
xcode-select --install -
This installs the Command Line Tools, which include:
-
clang/clang++ -
lldb -
make,git, etc. -
macOS SDK headers
-
-
-
-
The corresponding path of installation has to be added to the PATH.
Commands
-
The vast majority of all commands are exactly the same as GCC.
-
Exclusive to Clang :
-
-fcolor-diagnostics-
Displays colored errors/warnings (great for readability).
-
-
-Weverything-
Enables all warnings (even the most pedantic).
-
-
-MJ <file.json>-
Generates JSON output for analysis tools (ex: IDEs).
-
-
Opinions
-
Ginger Bill:
-
I wish I never used LLVM in the first place.
-
It has been the vast majority of the bugs in the Odin compiler.
-
It's slow as fuck, even for development builds.
-
And it gets worse with each release.
-
It's alluring because it's free and is the basis of clang.
-
-
Jonathan Blow:
-
JAI uses LLVM for release builds, but not for debug builds.
-
Making a language
-
-
"The parser we will build uses a combination of Recursive Descent Parsing and Operator-Precedence Parsing to parse the Kaleidoscope language (the latter for binary expressions and the former for everything else)".
-
AST Code .
-
-
Dmitry Soshnikov - LLVM Tutorial.-
Most of the time he's making a very simple code, but making it sound so confusing due to excessive OOP and C++.
-
He didn't finished the tutorials; there's only 5/20 lectures so far.
-
-
-
He follows the Language Frontend with LLVM line by line in C++, without much explanation.
-
LLVM Global Context
-
It owns and manages the core "global" data of LLVM's core infrastructure, including the types and constant unique tables.
Tilde Backend (TB)
MSVC (Microsoft Visual C++)
-
It is the default compiler for Visual Studio.
-
cl.exe(MSVC). -
License :
-
Microsoft proprietary.
-
-
Platforms :
-
Windows / Linux.
-
-
Languages :
-
Limited support for C11/C17
-
-
Requirements :
-
Windows:
-
Install Visual Studio (Community Edition is free).
-
Or maybe the Build Tools.
-
Honestly, you will have to download Visual Studio anyway.
-
-
-
Linux:
-
Limited support (using
clang-clor WSL).
-
-
-
My version :
-
14.42.34433 (came with Visual Studio).
-
Had to add
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.42.34433\bin\Hostx64\x64to the global PATH environment variable.
-
Commands
-
GCC or Clang equivalents :
-
.
-
-
MSVC-specific :
-
/MDvs/MT-
Chooses runtime: shared DLL (
/MD) or static (/MT).
-
-
/EHsc-
Enables C++ exceptions (default in C++ projects).
-
-
/JMC-
Supports "Just My Code" in the debugger.
-
-
/MP-
Parallel compilation (speeds up large builds).
-
-
// Equivalent to `gcc -o`
cl hello.c /Fehello.exe
// Compile with maximum warnings and debug
cl /W4 /WX /Zi hello.c /Fehello_debug.exe
// Compile with optimization (`/O2`) and C17 standard
cl /O2 /std:c17 programa.c /Feprograma_otimizado.exe
// Link with Windows libraries (e.g., `user32.lib`)
cl winapp.c /link user32.lib /Fewinapp.exe
// Compile multiple files
cl /c arquivo1.c # Generates arquivo1.obj
cl /c arquivo2.c # Generates arquivo2.obj
cl arquivo1.obj arquivo2.obj /Feprograma.exe
Windows SDK
What it includes
-
Headers and Libraries :
-
Header files ( .h ) and linking libraries ( .lib ) to access Windows APIs.
-
Examples:
-
Win32 API : To create windows, manage files, etc.
-
DirectX : For graphics and game development.
-
GDI/GDI+ : For 2D graphics.
-
COM (Component Object Model) : For reusable components.
-
-
-
Compilers :
-
Includes MSVC (Microsoft Visual C++) , used to compile native Windows code.
-
-
Debuggers and Tools :
-
Tools such as WinDbg for advanced debugging.
-
-
Resource Viewers :
-
Tools to create and edit resource files (.rc), like icons, menus, and strings.
-
-
Windows App Certification Kit :
-
Used to validate apps against Microsoft Store guidelines.
-
-
Command-Line Tools :
-
Includes utilities like:
-
rc.exe: Resource file compiler. -
mt.exe: Manifest tool. -
signtool.exe: Binary signing tool.
-
-
-
ARM64 Support :
-
Headers and libraries to compile apps for ARM devices on Windows.
-
QBE
-
QBE .
-
"QBE is a compiler backend that aims to provide 70% of the performance of industrial optimizing compilers in 10% of the code."
-
"The size limit constrains QBE to focus on the essential and prevents embarking on a never-ending path of diminishing returns."
-
-
QBE Demo .
Opinions
-
Ginger Bill:
-
On Windows, and it's actually awful.
-
Worse than LLVM.
-
You have to generate a textual IR that you then pass to its library for it to be consumed.
-
And mainly because you cannot use it as a library whatsoever. It's designed not to be used as a library.
-
QBE is a no-go.
-
I've considered before, and no.
-